package com.stox.model;


public class Exchange extends AbstractModel{
	private static final long serialVersionUID = 1L;

	private String countryCode;
	
	public Exchange() {
		
	}
	
	public Exchange(String countryCode, String text) {
		String[] tokens = text.split(",");
		setCode(tokens[0]);
		setName(tokens[1]);
		setCountryCode(countryCode);
	}

	@Override
	public String toString() {
		return getCode()+","+getName();
	}
	
	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result
				+ ((countryCode == null) ? 0 : countryCode.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Exchange other = (Exchange) obj;
		if (countryCode == null) {
			if (other.countryCode != null)
				return false;
		} else if (!countryCode.equals(other.countryCode))
			return false;
		return true;
	}

	

}
